package com.softa.web.controller.business;

import com.github.pagehelper.PageInfo;
import com.softa.dao.dto.SysMessageDTO;
import com.softa.service.system.SysMessageService;
import com.softa.utils.Constants;
import com.softa.vo.DataGridRequest;
import com.softa.vo.DataGridResponse;
import com.softa.vo.QueryRequest;
import com.softa.web.controller.base.BaseController;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;

/**
 * Created by yangl on 2017/7/29.
 * 消息记录
 */
@Controller
@RequestMapping("/message")
public class SysMessageController extends BaseController {

    @Resource
    private SysMessageService sysMessageService;

    @RequestMapping(method = RequestMethod.GET)
    public String list(Model model) {
        return Constants.MENU_MANAGE+"/message/list";
    }

//    @RequiresPermissions("message:view")
    @RequestMapping(value="/listPage",method = RequestMethod.POST)
    @ResponseBody
    public DataGridResponse listPage(DataGridRequest request, QueryRequest queryRequest) {
        PageInfo<SysMessageDTO> pageResult = sysMessageService.queryProductTypeByParam(request, queryRequest);
        return new DataGridResponse(pageResult);
    }
}
